"use client"
import React from 'react';
// import axios from 'axios';
import { Table, Button, Popconfirm } from "antd";
import DelectStudentButton from './DelectStudentButton'
// import NewStudentButton from 'NewStudentButton'

const UserList=async({students})=>{
    console.log("进入了学生列表")
    console.log("studentList",students)
    const colums = [
        {
          title:"ID",
          dataIndex:"id",
          key:"id"
        },
        {
          title:"name",
          dataIndex:"name",
          key:"name"
        },
       
        {
          title:"操作",
        //   dataIndex:"status",
          key:"action",
          render:(_,row)=>(
        <div style={{display:"flex"}}>
        <Button>修改</Button>
        <Popconfirm title="确定要删除吗?" >
            {/* <Button>删除</Button> */}
            <DelectStudentButton id={row.id}/>
        </Popconfirm>
        
        </div>
          )
        },
       
    ];
    
    //   return <Table  columns={colums} dataSource={students} />;
    return(
        <div>
            <h1> 学生列表
                <Button type="primary"size='small' href="/courses">
                    新增
                </Button>
            {/* <NewStudentButton/> */}
            <Table  columns={colums} dataSource={students} />
            </h1>
        </div>
    )
}

export default UserList;